using System.Linq;
using SapaFinance.Domain.Model;
using SapaFinance.GenericRepository;

namespace SapaFinance.Domain
{
    public interface ICurrencySpecification : ISpecification<Currency>
    {
        ICurrencySpecification WithName(string name);
    }

    public class CurrencyQueryableSpecification
       : QueryableSpecification<Currency>
         , ICurrencySpecification
    {

        public CurrencyQueryableSpecification(IUnitOfWorkConvertor unitOfWorkConvertor)
            : base(unitOfWorkConvertor)
        {
        }

        public ICurrencySpecification WithName(string name)
        {
            this.Queryable = this.Queryable.Where(c => c.Name == name);
            return this;
        }

    }
}